<h2>Inscriere la tema: <?php echo $tema['Theme']['name']; ?></h2>
<div class="account-form">
    <fieldset>
        <?php echo $this->Form->create( null, array(
            "url"  => array(
                "controller" => "students",
                "action"     => "inscriere_tema",
                $tema['Theme']['id']
            ),
            "type" => "post"
        ) ) ?>
        <?php echo $this->Form->hidden( "Theme.id_stud", array( "value" => $user_id ) ) ?>
        <div class="form-group"><?php echo $tema['Theme']['description']; ?></div>
        <?php foreach( $tema['Requirement'] as $req ) : ?>
            <div class="form-group">
                <?php switch( $req['type'] ) {
                    case "select":
                        echo $this->Form->input( "Requirement." . $req['id'], array(
                            "type"     => "select",
                            "label"    => $req['name'],
                            "options"  => array_combine( explode( ",", $req['type_values'] ), explode( ",", $req['type_values'] ) ),
                            "required" => ( $req['required'] == 1 ) ? true : false,
                            "class"    => "form-control"
                        ) );
                        break;
                    case "radio":
                        echo $this->Form->radio( "Requirement." . $req['id'] . "", array_combine( explode( ",", $req['type_values'] ), explode( ",", $req['type_values'] ) ), array(
                            "legend"      => false,
                            "hiddenField" => false,
                            "required"    => ( $req['required'] == 1 ) ? true : false
                        ) );
                        break;
                    case "checkbox":
                        $values = explode( ",", $req['type_values'] );
                        echo $this->Form->input( "Requirement." . $req['id'], array(
                            'type'        => 'select',
                            'multiple'    => 'checkbox',
                            "label"       => $req['name'],
                            'options'     => array_combine( explode( ",", $req['type_values'] ), explode( ",", $req['type_values'] ) ),
                            "hiddenField" => false,
                            "required"    => ( $req['required'] == 1 ) ? true : false
                        ) );
                        break;
                    case "textarea":
                        echo $this->Form->input( "Requirement." . $req['id'] . "", array(
                            "label" => $req['name'],
                            "type"  => "textarea",
                            "class" => "form-control",
                            "pattern" => "[a-zA-Z0-9]+"
                        ) );
                        break;
                    default:
                        echo $this->Form->input( "Requirement." . $req['id'] . "", array(
                            "label" => $req['name'],
                            "class" => "form-control"
                        ) );
                } ?>
            </div>
        <?php endforeach; ?>
    <?php
        if($ok==1)
                 echo $this->Form->end( array( "label" => "Inscrie", "class" => "btn" ) ) ?>    
    </fieldset>
    
</div>